import { getIndustryType } from '@/api/common'
export default {
  data() {
    return {
      industryOptions: [],
    }
  },
  mounted() {
  },
  methods: {
    // 获取所有行业类型
    async getIndustryType() {
      const { status, data } = await getIndustryType()
      if (status === 0 && data) {
        this.industryOptions = this.recursion(data)
      }
    },
    // 级联数据递归
    recursion(data) {
      return data.map((x) => {
        return {
          id: x.id,
          value: x.code,
          text: x.name,
          children: x.subList.length ? this.recursion(x.subList) : undefined
        }
      })
    }
  }
}
